nwn2fandomcom-20200214-history
Deep Slumber
Description This spell functions like Sleep, except that it affects 10 HD of creatures. Bug Notes Many are the same as Sleep_(spell), as Obsidian simply copied the Sleep script, along with all bugs. Updated Bug section: Script shipped with game version 1.0.23.1765. Differences between script and description: The script works on 10 + d10 HD of creatures (not mentioned in the description and not in line with the d20 rules, where the spell affects 10 hd overall, no random roll), maximum HD of creature affected is 5 (which matches Sleep, but also not mentioned; should be 10 according to d20 rules). Line 65: nMax should be set to 11 instead of 9 (because highest level affected is 10). This is needed for the search for the creature with the lowest HD (line 99: nCurrentHD < nLow -> here the script initially searches for any valid creature (nCurrentHD < 11), then compares it to any other affected creatures' HD by setting the nLow variable to a new value during every loop. Also, on line 99, highest level affected is set as 5 (nCurrentHD < 6), should be "nCurrentHD <= 10", because, according to the d20 rules, highest level affected is 10. However, nCurrentHD < nLow already takes care of the highest level affected (10), so this check is redundant anyway. So the final condition looks like this: if(nCurrentHD < nLow //searching for lowest HD creature, initial search <11 (since 10 is max). Also sets max level affected at 10 && nCurrentHD <= nHD) // max hd affected all creatures together (20 maximised, 25 max empowered if you are lucky) Line 66: Error in the way Empower works (only affecting the dice roll), it should be nRoll (defined as d10() before), and have an additional initial 10 added afterwards. Empowered HD highest total: 10+ 10 + (10/2)=25: int nMetaMagic = GetMetaMagicFeat(); int nRoll=d10(); //for Empower int nHD = 10+ nRoll; if (nMetaMagic METAMAGIC_EMPOWER) { nHD = 10+ nRoll + (nRoll/2); } However, if you want to bring the spell in line with the d20 rules (10 hd affected), the calculation should look like this: int nHD = 10; //just 10, no additional random d10 roll nHD = ApplyMetamagicVariableMods(nHD, 20); //20 hd maximised, 15 hd empowered(instead of 25 hd max the vanilla script gives you) Line 89: The script explicitly excludes construct and undead racial types. These races are immune to sleep anyway, but the actual problem here is that undead and constructs are excluded from the total HD AFFECTED by the spell, so if they are within the sleep range, they do not waste any HD (basically an unintentional reduction of game difficulty). This is probably an improper interpretation of the DnD rules, which state that "Sleep does not target unconscious creatures, constructs, or undead creatures" - "target" is used in the sense of "they are immune" and not "they are not affected." In order to fix, remove the construct/undead checks. The internal game mechanics will ensure that they will ignore the sleep effect anyway. Line 111: The check "if(oLowest != OBJECT_INVALID)" should use GetIsObjectValid() since this test sometimes does not work, so should be "if(GetIsObjectValid(oLowest))" Line 136-143: oLowest may be invalid (see line 111) these things should be moved into the statement section that checks if oLowest is valid. Line 139: Setting the LocalInt to FALSE is redundant, the DeleteLocalInt on line 140 is sufficient. NWN comparison *This spell did not exist in NWN. External resources *d20 SRD Deep Slumber